Fix #150: remove duplicate osipi_check_required_bvalues definition - #171
Open
Devguru-codes wants to merge 1 commit into
Open
Fix #150: remove duplicate osipi_check_required_bvalues definition#171Devguru-codes wants to merge 1 commit into
Devguru-codes wants to merge 1 commit into
Conversation
) OsipiBase defined osipi_check_required_bvalues twice. The second definition was a bare `pass` stub that shadowed the first, so the method returned None instead of a boolean. Remove the shadowing stub. The surviving definition returns True and is consistent with its siblings osipi_check_required_thresholds, osipi_check_required_bounds and osipi_check_required_initial_guess. Add a regression test that parses OsipiBase with ast and asserts no method name is defined more than once, and that all four osipi_check_required_* methods return a boolean rather than None. The test was confirmed to fail against the pre-fix code. Scope is kept to the duplicate only; implementing the actual requirement checks is issue OSIPI#45, covered by PR OSIPI#96. Fixes OSIPI#150
This comment was marked as spam.
This comment was marked as spam.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the changes you have made in this PR
OsipiBasedefinedosipi_check_required_bvaluestwice. The second definition was a barepassstub that shadowed the first, so the method returnedNoneinstead of a boolean.This PR removes the shadowing stub and adds a regression test so that a duplicate method definition cannot silently reappear.
The surviving definition returns
Trueand is consistent with its three siblingsosipi_check_required_thresholds,osipi_check_required_boundsandosipi_check_required_initial_guess.Verification
The pre-fix class was loaded directly from git and compared against the fixed one, so the result does not depend on reading the diff correctly:
osipi_check_required_bvalues()NoneTrueThe public API is unchanged, and every remaining method is byte-identical (
__code__.co_code) to before, so this change cannot affect any other behaviour.Regression test
tests/IVIMmodels/unit_tests/test_ivim_fit.py::test_no_duplicate_method_definitions_in_osipibaseIt parses
OsipiBasewithastand asserts that no method name is defined more than once — guarding against any future duplicate, not only this one — then asserts that all fourosipi_check_required_*methods return a boolean rather thanNone.The test was confirmed to fail against the pre-fix code and pass after, so it is a real guard rather than one that passes vacuously.
np.bool_is accepted alongsideboolso the test does not obstruct a future real implementation of these checks.Test suite
Run from the repository root (Windows, Python 3.11.3, pytest 9.0.2):
No failures. The skips are the MATLAB-dependent algorithms (no
matlab.enginelocally) and the deep-learning skips; the xfails/xpasses are the pre-existingTCML_TechnionIIT_lsqBOBYQAentries fromalgorithms.json.test_volumeandtest_parallel(54 tests) were not run locally, as they require the XCAT phantom downloaded from Zenodo which is not present in my environment. CI covers them, and per the byte-identity check above this change cannot affect them.Link this PR to an issue [optional]
Fixes #150
Checklist